

package com.hazelcast.client.impl.protocol.codec.custom;

import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.impl.protocol.Generated;
import com.hazelcast.client.impl.protocol.codec.builtin.CustomTypeFactory;
import com.hazelcast.client.impl.protocol.codec.builtin.StringCodec;

import static com.hazelcast.client.impl.protocol.ClientMessage.BEGIN_FRAME;
import static com.hazelcast.client.impl.protocol.ClientMessage.END_FRAME;
import static com.hazelcast.client.impl.protocol.codec.builtin.CodecUtil.fastForwardToEndFrame;

@SuppressWarnings("unused")
@Generated("241b4b78300eb415ec765af0c3ea6f95")
public final class HazelcastJsonValueCodec {

    private HazelcastJsonValueCodec() {
    }

    public static void encode(ClientMessage clientMessage, com.hazelcast.core.HazelcastJsonValue hazelcastJsonValue) {
        clientMessage.add(BEGIN_FRAME.copy());

        StringCodec.encode(clientMessage, hazelcastJsonValue.getValue());

        clientMessage.add(END_FRAME.copy());
    }

    public static com.hazelcast.core.HazelcastJsonValue decode(ClientMessage.ForwardFrameIterator iterator) {
        // begin frame
        iterator.next();

        java.lang.String value = StringCodec.decode(iterator);

        fastForwardToEndFrame(iterator);

        return CustomTypeFactory.createHazelcastJsonValue(value);
    }
}
